#ifndef SDRV_FLEXCAN_CFG_H_
#define SDRV_FLEXCAN_CFG_H_

#include <sdrv_flexcan.h>

/* for 40MHz. */
#define BAUDRATE_1M_5M                                                         \
    .nominalBitTiming =                                                        \
        {/* 1Mbps, sample point 80% */                                         \
         .preDivider = 1U,                                                     \
         .rJumpwidth = 5U,                                                     \
         .propSeg = 10U,                                                       \
         .phaseSeg1 = 21U,                                                     \
         .phaseSeg2 = 8U},                                                     \
    .dataBitTiming =                                                           \
        {/* 5Mbps, sample point 75% */                                         \
         .preDivider =                                                         \
             1U, /* Should be the same as nominalBitTiming.preDivider. */      \
         .rJumpwidth = 1U,                                                     \
         .propSeg = 2U,                                                        \
         .phaseSeg1 = 3U,                                                      \
         .phaseSeg2 = 2U}

/* for 40MHz. */
#define BAUDRATE_500K_1M                                                       \
    .nominalBitTiming =                                                        \
        {/* 500kbps, sample point 75% */                                       \
         .preDivider = 4U,                                                     \
         .rJumpwidth = 2U,                                                     \
         .propSeg = 6U,                                                        \
         .phaseSeg1 = 8U,                                                      \
         .phaseSeg2 = 5U},                                                     \
    .dataBitTiming =                                                           \
        {/* 1Mbps, sample point 80% */                                         \
         .preDivider =                                                         \
             4U, /* Should be the same as nominalBitTiming.preDivider. */      \
         .rJumpwidth = 2U,                                                     \
         .propSeg = 3U,                                                        \
         .phaseSeg1 = 4U,                                                      \
         .phaseSeg2 = 2U}

#define RX_FIFO_ID_FILTER_NUM 32
#define USED_MB_FOR_FIFO 14
#define TX_MAILBOX_NUM 7

extern const flexcan_config_t g_flexcan_config;
extern flexcan_rx_fifo_config_t flexcan_fifo_cfg;

#endif /* SDRV_FLEXCAN_CFG_H_ */
